<?php


namespace app\admin\controller\firm;

use app\api\model\v1\FirmInfo;
use app\common\controller\Backend;

class Info extends Backend
{
    public function index()
    {
        if ($this->request->isPost()) {
            $params = $this->request->post('row/a');
            $infoModel = FirmInfo::find();
            if (!$infoModel) {
                $infoModel = new FirmInfo();
            }
            $infoModel->content = $params['content'];
            $infoModel->image = $params['image'];
            $infoModel->title = $params['title'];
            $infoModel->title_eng = $params['title_eng'];
            $infoModel->save();

            $this->success("提交成功", null);
        }
        $row = FirmInfo::find();
        $this->view->assign('row', $row);
        return $this->view->fetch();
    }
}